/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author TANGQUOCTUAN
 */
@Entity
@Table(name = "BookRooms", catalog = "TUNGA", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "BookRooms.findAll", query = "SELECT b FROM BookRooms b"),
    @NamedQuery(name = "BookRooms.findByBookRoomID", query = "SELECT b FROM BookRooms b WHERE b.bookRoomID = :bookRoomID"),
    @NamedQuery(name = "BookRooms.findReportBookRoom", query = "SELECT b FROM BookRooms b WHERE b.endDayTime >= :fromdate AND b.endDayTime<= :todate"),
    @NamedQuery(name = "BookRooms.findByBookRoomByUser", query = "SELECT b FROM BookRooms b WHERE b.customers.custID = :custID"),
    @NamedQuery(name = "BookRooms.findByCapacity", query = "SELECT b FROM BookRooms b WHERE b.capacity = :capacity"),
    @NamedQuery(name = "BookRooms.findByStartDayTime", query = "SELECT b FROM BookRooms b WHERE b.startDayTime = :startDayTime"),
    @NamedQuery(name = "BookRooms.findByEndDayTime", query = "SELECT b FROM BookRooms b WHERE b.endDayTime = :endDayTime"),
    @NamedQuery(name = "BookRooms.findByReserveFee", query = "SELECT b FROM BookRooms b WHERE b.reserveFee = :reserveFee"),
    @NamedQuery(name = "BookRooms.findByStatus", query = "SELECT b FROM BookRooms b WHERE b.status = :status")})
public class BookRooms implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Basic(optional = false)
    @Column(name = "BookRoomID", nullable = false)
    private Integer bookRoomID;
    @Basic(optional = false)
    @Column(name = "Capacity", nullable = false)
    private int capacity;
    @Basic(optional = false)
    @Column(name = "StartDayTime", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date startDayTime;
    @Basic(optional = false)
    @Column(name = "EndDayTime", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date endDayTime;
    @Basic(optional = false)
    @Column(name = "ReserveFee", nullable = false, precision = 19, scale = 4)
    private BigDecimal reserveFee;
    @Basic(optional = false)
    @Column(name = "Status", nullable = false)
    private boolean status;
    @JoinColumn(name = "RoomID", referencedColumnName = "RoomID", nullable = false)
    @ManyToOne(optional = false)
    private Rooms rooms;
    @JoinColumn(name = "ResID", referencedColumnName = "ResID", nullable = false)
    @ManyToOne(optional = false)
    private Restaurants restaurants;
    @JoinColumn(name = "CustID", referencedColumnName = "CustID", nullable = false)
    @ManyToOne(optional = false)
    private Customers customers;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bookRooms")
    private List<CancelBookRoom> cancelBookRoomList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bookRooms")
    private List<BookRoomDetails> bookRoomDetailsList;

    public BookRooms() {
    }

    public BookRooms(Integer bookRoomID) {
        this.bookRoomID = bookRoomID;
    }

    public BookRooms(Integer bookRoomID, int capacity, Date startDayTime, Date endDayTime, BigDecimal reserveFee, boolean status) {
        this.bookRoomID = bookRoomID;
        this.capacity = capacity;
        this.startDayTime = startDayTime;
        this.endDayTime = endDayTime;
        this.reserveFee = reserveFee;
        this.status = status;
    }

    public BookRooms(int capacity, Date startDayTime, Date endDayTime, BigDecimal reserveFee) {
        this.capacity = capacity;
        this.startDayTime = startDayTime;
        this.endDayTime = endDayTime;
        this.reserveFee = reserveFee;
    }

    public Integer getBookRoomID() {
        return bookRoomID;
    }

    public void setBookRoomID(Integer bookRoomID) {
        this.bookRoomID = bookRoomID;
    }

    public int getCapacity() {
        return capacity;
    }

    public void setCapacity(int capacity) {
        this.capacity = capacity;
    }

    public Date getStartDayTime() {
        return startDayTime;
    }

    public void setStartDayTime(Date startDayTime) {
        this.startDayTime = startDayTime;
    }

    public Date getEndDayTime() {
        return endDayTime;
    }

    public void setEndDayTime(Date endDayTime) {
        this.endDayTime = endDayTime;
    }

    public BigDecimal getReserveFee() {
        return reserveFee;
    }

    public void setReserveFee(BigDecimal reserveFee) {
        this.reserveFee = reserveFee;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public Rooms getRooms() {
        return rooms;
    }

    public void setRooms(Rooms rooms) {
        this.rooms = rooms;
    }

    public Restaurants getRestaurants() {
        return restaurants;
    }

    public void setRestaurants(Restaurants restaurants) {
        this.restaurants = restaurants;
    }

    public Customers getCustomers() {
        return customers;
    }

    public void setCustomers(Customers customers) {
        this.customers = customers;
    }

    public List<CancelBookRoom> getCancelBookRoomList() {
        return cancelBookRoomList;
    }

    public void setCancelBookRoomList(List<CancelBookRoom> cancelBookRoomList) {
        this.cancelBookRoomList = cancelBookRoomList;
    }

    public List<BookRoomDetails> getBookRoomDetailsList() {
        return bookRoomDetailsList;
    }

    public void setBookRoomDetailsList(List<BookRoomDetails> bookRoomDetailsList) {
        this.bookRoomDetailsList = bookRoomDetailsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bookRoomID != null ? bookRoomID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BookRooms)) {
            return false;
        }
        BookRooms other = (BookRooms) object;
        if ((this.bookRoomID == null && other.bookRoomID != null) || (this.bookRoomID != null && !this.bookRoomID.equals(other.bookRoomID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.BookRooms[bookRoomID=" + bookRoomID + "]";
    }
}
